package com.hdax.dmw.base.controller;

import com.hdax.dmw.base.service.ImageService;
import com.hdax.dmw.entity.base.Image;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ImageController {

    @Autowired
    private ImageService imageService;

    @Value("${server.port}")
    private String port;

    @PostMapping(path = "/base/image")
    public Image image(@RequestParam("targetId")Long targetId,
                       @RequestParam("type")Integer type,
                       @RequestParam("category")Integer category){
        Image image = imageService.image(targetId, type, category);
        System.out.println(port);
        return image;
    }

}
